package com.jacky.components;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.util.Objects;

public class SideNavPanelApp extends Application {

    double x, y;

    @Override
    public void start(Stage primaryStage) throws Exception {
        Parent root = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("side-nav-panel.fxml")));
        primaryStage.setTitle("SideNavPanel");
        root.setOnMousePressed(evt -> {
            x = evt.getSceneX();
            y = evt.getSceneY();
        });
        root.setOnMouseDragged(evt -> {
            primaryStage.setX(evt.getSceneX() - x);
            primaryStage.setY(evt.getSceneY() - y);
        });
        primaryStage.setScene(new Scene(root, 780, 550));
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
